package com.network.topo.netwatch;

import java.util.ArrayList;

public class FetchRunner{

    private ArpTableFetcher fetcher;
    private String deviceName;

    public FetchRunner(){
    	
    }
    public FetchRunner(String hostName,String commStr,String name) {
        fetcher = new ArpTableFetcher(hostName,commStr);
        deviceName = name;
    }

    public int run() {
        System.out.printf("Fetching arp table from %s: ",deviceName);
        ArrayList arp = fetcher.getArpTable();
        for (int i=0;i<arp.size();i++) {
            String[] entry = (String[])arp.get(i);
            System.out.printf("%s/t%s/t%s/n",entry[0],entry[1],entry[2]);
        }
        System.out.printf(" Total %d entries retrieved. /n", arp.size());
        return arp.size();
    }
}